﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="Contact.aspx.cs" Inherits="FashionMural.Web.Contact" %>

<%@ Import Namespace="Omes.Model" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <%--<div class="position_bg fuwuxm">
            <div class="position_con">
            <div class="position">首页 > 关于我们 > 联系我们</div>
            <div class="contact">
                <ul>
                    <li ><a href="/CompanyDesc.aspx">公司简介</a></li>
                    <li ><a href="/AboutDesc.aspx">招贤纳士</a></li>
                    <li><a href="/News.aspx">新闻资讯</a></li>
                    <li class="conpany"><a >联系我们</a></li>
                    <li ><a href="/PublicChat.aspx">互动客厅</a></li>
                </ul>
            </div>
            <asp:PlaceHolder runat="server" ID="contentPH">
                qustion
            </asp:PlaceHolder>
        </div>
    </div>--%>
    <div class="position_bg ask_que">
        <div class="position_con">
            <div class="position">
                首页 > 关于我们 > 联系我们</div>
            <!--公司简介开始-->
            <div class="contact">
                <ul>
                     <li ><a href="/CompanyDesc.aspx">公司简介</a></li>
                    <li ><a href="/AboutDesc.aspx">招贤纳士</a></li>
                    <li><a href="/News.aspx">新闻资讯</a></li>
                    <li class="conpany"><a >联系我们</a></li>
                    <li ><a href="/PublicChat.aspx">互动客厅</a></li>
                    <ul>
            </div>
            <div class="question">
                <img class="gt" src="images/goutong.jpg" />
                <img class="mp" src="images/maps.jpg" />
                <p>
                    地 址：长沙市岳麓区天马创意城(天马小区)18栋6单元301<br />
                    固定电话：0731-85206720<br />
                    手 机：18684739989 13317319992<br />
                    邮 箱：13317319992@163.com
                </p>
            </div>
            <div class="ask">
                <img src="images/jiaojie.jpg" />
                <h1>
                    line</h1>
                <p>
                    <%foreach (QuestionNaire singleQuesiton in SingleQuesitons)
                      {%>
                    <div id="single<%=singleQuesiton.Id %>">
                        <div>
                            <%=singleQuesiton.QuestionContent %></div>
                        <%foreach (QuestionNaireAnswer questionNaireAnswer in this.GetAnswers(singleQuesiton.Id))
                          {%>
                        <div>
                            <input name="answer<%=questionNaireAnswer.Id %>" type="radio" value="<%=questionNaireAnswer.Id %>" />
                            <%=questionNaireAnswer.Answer %></div>
                        <%} %></div>
                    <br />
                    <%} %>
                    <br />
                    <%foreach (QuestionNaire multiQuestion in MultiQuestions)
                      {%>
                    <div id="mul<%=multiQuestion.Id %>">
                        <div>
                            <%=multiQuestion.QuestionContent %></div>
                        <%foreach (QuestionNaireAnswer questionNaireAnswer in this.GetAnswers(multiQuestion.Id))
                          {%>
                        <div>
                            <input name="answer<%=questionNaireAnswer.Id %>" type="checkbox" value="<%=questionNaireAnswer.Id %>" /><%=questionNaireAnswer.Answer %>
                        </div>
                        <%} %>
                    </div>
                    <br />
                    <%} %>
                    <br />
                    <%foreach (QuestionNaire questionNaire in SelfQuestions)
                      {%>
                    <div>
                        <%=questionNaire.QuestionContent %></div>
                    <div id="self<%=questionNaire.Id %>">
                        <input id="answer<%=questionNaire.Id %>" type="text" value="答案" /></div>
                    <br />
                    <%} %>
                    <br />
                </p>
                <label id="checkquestion" onclick="sa()">
                    提交</label>
            </div>
        </div>
    </div>
    <script type="text/javascript">
//        var datename = new Date();
//        var username = datename.getYear + datename.getMonth + datename.getDay + datename.getHours + datename.getMinutes + datename.getSeconds + datename.getMilliseconds();

        function saveSinlgeQuestion(userid, questionid, answerid) {
            $.ajax({
                type: "POST",
                async: false,
                url: "/JSserver.aspx?who=single",
                data: { user: userid, questionid: questionid, answerid: answerid },
                success: function (data) {
                    if (data > 0) {

                    }
                },
                error: function () {

                }
            }
   );
        }

//        function saveMulQuestion(userid, questionid, answerids) {
//            if (answerids.length > 0) {
//                for (i = 0; i < answerids.length; i++) {
//                    saveSinlgeQuestion(userid, questionid, answerids[i]);
//                }
//            }
//        }

        function saveSelfQuestion(userid, questionid, answer) {
            $.ajax({
                type: "POST",
                async: false,
                url: "/JSserver.aspx?who=self",
                data: { userid: userid, questionid: questionid, answer: answer },
                success: function (data) {
                    if (data > 0) {

                    }
                },
                error: function () {

                }
            }
   );
        }

        function sa(){
            var datename = new Date();
            var username = datename.getMonth().toString() + datename.getDay().toString() + datename.getHours().toString() + datename.getMinutes().toString() + datename.getSeconds().toString();
            var userId = parseInt(username);

            var sinlges = eval(<%=JSSingles %>);
            if(sinlges.length>0){
                for(i=0;i<sinlges.length;i++){
                    var sqid = sinlges[i].Id;
                    var saids = $("#single"+sqid+" input[type=radio]");
                    if(saids.length>0){
                        for(j=0;j<saids.length;j++){
                            if($(saids[j])[0].checked){
                                saveSinlgeQuestion(userId,sqid,$(saids[j]).val());
                            }
                        }
                    }
                }
            }

            var muls = eval(<%=JSMuls %>);
            if(muls.length>0){
                for(i=0;i<muls.length;i++){
                    var mqid = muls[i].Id;
                    var madis = $("#mul"+mqid+" input[type=checkbox]");
                    if(madis.length>0){
                        for(j=0;j<madis.length;j++){
                            if($(madis[j])[0].checked){
                                saveSinlgeQuestion(userId,mqid,$(madis[j]).val());
                            }
                        }
                    }
                }
            }

            var selfs = eval(<%=JSSelf %>);
            if(selfs.length>0){
                for(i=0;i<selfs.length;i++){
                    var slqid = selfs[i].Id;
                    var slans = $("#answer"+slqid).val();
                    saveSelfQuestion(userId,slqid,slans);
                }
            }

            alert('添加成功！');

        }


    </script>
</asp:Content>
